package org.codeCard.panel;

import com.updateNew.MyIsif;
import org.codeCard.btn.CodeCardBtn;
import org.come.until.CutButtonImage;

import javax.swing.*;
import java.awt.*;

/**
 * @author HGC<br>
 * @time 2019年12月20日 上午9:44:41<br>
 * @class 类名:PartnerMainJpanel 伙伴主面板 编号：105<br>
 */
public class CodeCardMainJPanel extends JPanel {

    private CodeCardJPanel bjczCardJpanel;

    private CodeCardBtn bjczBtn1, bjczBtn2;

    public static Boolean IS_BUY = true;

    public CodeCardMainJPanel() {
        if (MyIsif.getStyle().equals("水墨UI")) {
            this.setOpaque(false);
            setPreferredSize(new Dimension(481,500));
            setLayout(null);
            bjczCardJpanel = new CodeCardJPanel();
            bjczCardJpanel.setBounds(0, 0, 481, 500);
            this.add(bjczCardJpanel);
        }else {
            this.setOpaque(false);
            setPreferredSize(new Dimension(452, 527));
            setLayout(null);
            bjczCardJpanel = new CodeCardJPanel();
            bjczCardJpanel.setBounds(0, 0, 452, 527);
            this.add(bjczCardJpanel);
        }

//        getBtnTeam();
//        getBtnSkill();
    }

    private ImageIcon smIcon = CutButtonImage.getImage("inkImg/number/b9/b9-sm-buy-bg.png", 481,500);
    private ImageIcon hmIcon = CutButtonImage.getImage("inkImg/number/b9/b9-hm-buy-bg.png", 452,527);

    private ImageIcon smIcon_s = CutButtonImage.getImage("inkImg/number/b9/b9-sm-sell-bg.png", 481,500);
    private ImageIcon hmIcon_s = CutButtonImage.getImage("inkImg/number/b9/b9-hm-sell-bg.png", 452,527);


    private ImageIcon iconBack;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);

//        if(IS_BUY){
//            if (MyIsif.getStyle().equals("水墨UI")) {
//                g.drawImage(smIcon.getImage(), 0, 0, 481,500, this);
//            }else {
//                g.drawImage(hmIcon.getImage(), 0, 0, 452,527, this);
//            }
//        }else{
//            if (MyIsif.getStyle().equals("水墨UI")) {
//                g.drawImage(smIcon_s.getImage(), 0, 0, 481,500, this);
//            }else {
//                g.drawImage(hmIcon_s.getImage(), 0, 0, 452,527, this);
//            }
//        }

    }

    public CodeCardJPanel getBjczCardJpanel() {
        return bjczCardJpanel;
    }

    public void setBjczCardJpanel(CodeCardJPanel bjczCardJpanel) {
        this.bjczCardJpanel = bjczCardJpanel;
    }

    public ImageIcon getIconBack() {
        return iconBack;
    }

    public void setIconBack(ImageIcon iconBack) {
        this.iconBack = iconBack;
    }

    public CodeCardBtn getBtnTeam() {
        if(this.bjczBtn1 != null){
            this.remove(bjczBtn1);
            bjczBtn1 = null;
        }
        if (MyIsif.getStyle().equals("水墨UI")) {

                bjczBtn1 = new CodeCardBtn("inkImg/number/b9/b9-sm-buy-big.png", 1, 1, this);
                bjczBtn1.setBounds(65, 17, 85, 35);
                this.add(bjczBtn1);

        }else {

                bjczBtn1 = new CodeCardBtn("img/xy2uiimg/B229.png", 1, 1, this);
                bjczBtn1.setBounds(80, 18, 85, 35);
                this.add(bjczBtn1);

        }
        return bjczBtn1;
    }


    public CodeCardBtn getBtnSkill() {
        if(this.bjczBtn2 != null){
            this.remove(bjczBtn2);
            bjczBtn2 = null;
        }
        if (MyIsif.getStyle().equals("水墨UI")) {

                bjczBtn2 = new CodeCardBtn("inkImg/number/b9/b9-sm-sell-small.png", 1, 2, this);
                bjczBtn2.setBounds(160, 19, 85, 35);
                this.add(bjczBtn2);

        }else {

                bjczBtn2 = new CodeCardBtn("img/xy2uiimg/B232.png", 1, 2, this);
                bjczBtn2.setBounds(160, 20, 85, 35);
                this.add(bjczBtn2);

        }
        return bjczBtn2;
    }

    public void rep() {

        this.remove(bjczCardJpanel);
        if (MyIsif.getStyle().equals("水墨UI")) {
            this.setOpaque(false);
            setPreferredSize(new Dimension(500,520));
            setLayout(null);
            bjczCardJpanel = new CodeCardJPanel();
            bjczCardJpanel.setBounds(0, 0, 500, 520);
            this.add(bjczCardJpanel);
        }else {
            this.setOpaque(false);
            setPreferredSize(new Dimension(452, 527));
            setLayout(null);
            bjczCardJpanel = new CodeCardJPanel();
            bjczCardJpanel.setBounds(0, 0, 452, 527);
            this.add(bjczCardJpanel);
        }
    }

    public CodeCardBtn getBjczBtn1() {
        return bjczBtn1;
    }

    public void setBjczBtn1(CodeCardBtn bjczBtn1) {
        this.bjczBtn1 = bjczBtn1;
    }

    public CodeCardBtn getBjczBtn2() {
        return bjczBtn2;
    }

    public void setBjczBtn2(CodeCardBtn bjczBtn2) {
        this.bjczBtn2 = bjczBtn2;
    }
}

